<?php

require_once 'OAuth/Signature/Abstract.php';

require_once 'Crypt/HMAC2.php';

class OAuth_Signature_Hmac extends OAuth_Signature_Abstract
{

    public function sign(array $params, $method = null, $url = null)
    {
        $hmac = new Crypt_HMAC2($this->_key, $this->_hashAlgorithm);
        $binaryHash = $hmac->hash(
            $this->_getBaseSignatureString($params, $method, $url),
            Crypt_HMAC2::BINARY
        );
        return base64_encode($binaryHash);
    }

}